#pragma once
#ifndef _CYLINDRICAL_SOLVER_
#define _CYLINDRICAL_SOLVER_

// Локальные
#include "abstractsolver.h"

//================================================================================================================================
//================================================================================================================================
class CylindricalSolver : public AbstractSolver
{
public:
    //****************************************************************************************************************************
    //****************************************************************************************************************************
    CylindricalSolver();
    ~CylindricalSolver();

    //****************************************************************************************************************************
    //****************************************************************************************************************************
    bool createNet();
    bool recreateNet();

    //****************************************************************************************************************************
    //****************************************************************************************************************************
    void formV();

    //****************************************************************************************************************************
    //****************************************************************************************************************************
    void cBC(int time_layer);
    void tBC(int time_layer);
    void vfBC(int time_layer);
    void psiBC(int time_layer);
    void omegaBC(int time_layer);

private:
    //****************************************************************************************************************************
    //****************************************************************************************************************************
    QList<geometry::_2d::Point> identifyFront(double temperature);
    QList<geometry::_2d::Point> identifyFrontExt(double temperature);

    void limitsForR(double z, double *r_min, double *r_max, int *num_of_points, bool meltOnly)
    {
        if(meltOnly){*r_min = 0; *r_max = 0.05; *num_of_points = m_N[7]/(*r_max);}
        else {*r_min = 0; *r_max = 0.055; *num_of_points = m_N[0]/(*r_max);}
    }

    void limitsForZ(double r, double *z_min, double *z_max, int *num_of_points, bool meltOnly)
    {
        if(meltOnly){*z_min = 0; *z_max = 0.055; *num_of_points = m_N[4]/(*z_max - *z_min);}
        else {*z_min = 0; *z_max = 0.055; *num_of_points = (m_N[4] + m_N[1])/(*z_max - *z_min);}
    }

    //****************************************************************************************************************************
    // Геометрические параметры каркаса конечноэлементной сетки.
    //****************************************************************************************************************************
    double m_R[13]; // r-координаты опорных точек.
    double m_Z[13]; // z-координаты опорных точек.
    double m_L[19]; // Длины сегментов границ подобласти.
    int m_N[19];    // Число узлов вдоль границ сегментов подобласти.
};

#endif // _CYLINDRICAL_SOLVER_
